Skip to content

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Sep 28, 2025

Add a delay before writing the files to ensure that the watcher receives the notifications.

Fixes: #60051
Refs: #52601

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Sep 28, 2025
for (const fileName of [...this.files]) {
await writeFile(this.filePath(fileName), Date.now() + fileName.repeat(1e4));
}
await setTimeout(common.platformTimeout(100));
Copy link
Member Author

@lpinca lpinca Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there was a reason for this I will add it back, but I don't see it.

Comment on lines +37 to +38
// Do the write with a delay to ensure that the OS is ready to notify us.
await setTimeout(common.platformTimeout(100));
Copy link
Member Author

@lpinca lpinca Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same is done in other fs.watch() tests, for example:

// Do the write with a delay to ensure that the OS is ready to notify us.
setTimeout(() => {
fs.writeFileSync(testFile, 'world');
}, common.platformTimeout(200));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this deserves a TODO to investigate why this is occuring and whether or not this is a bug.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already an open issue (#52601) linked in the commit message.

Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

lgtm

Copy link

codecov bot commented Sep 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.45%. Comparing base (6f941fc) to head (dfdbb39).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60060      +/-   ##
==========================================
- Coverage   88.45%   88.45%   -0.01%     
==========================================
  Files         703      703              
  Lines      207826   207826              
  Branches    40030    40038       +8     
==========================================
- Hits       183842   183826      -16     
+ Misses      15973    15972       -1     
- Partials     8011     8028      +17     

see 27 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2025
@nodejs-github-bot

This comment was marked as outdated.

@gurgunday gurgunday added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 1, 2025
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

Add a delay before writing the files to ensure that the watcher receives
the notifications.

Fixes: nodejs#60051
Refs: nodejs#52601
@lpinca lpinca force-pushed the deflake/test-fs-promises-watch-iterator branch from d3b5d31 to dfdbb39 Compare October 4, 2025 10:13
@lpinca
Copy link
Member Author

lpinca commented Oct 4, 2025

Rebased, this needs new approvals.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

parallel/test-fs-promises-watch-iterator is flaky
5 participants